<?php

require_once 'Zend/View/Helper/Abstract.php';

class Core_View_Helper_Cms_Scripts extends Zend_View_Helper_Abstract
{
    /**
     * inserts the code to include a script
     * pretty simple stuff, but nice and clean in the view
     *
     * @param files, array
     */
    public function scripts($files)
    {
        //get the style path
        $config = Zend_Registry::get('config');

        //build xhtml
        $xhtml = PHP_EOL . '<!--Beginning of scripts-->' . PHP_EOL;
        foreach ($files as $file) {
            $path = '/' . $config->filepath->script . '/' . $file;
            $xhtml .= "\t" . '<script type="text/javascript" src="' . $path . '"></script>' . PHP_EOL;
        }
        $xhtml .= '<!--End of scripts-->' . PHP_EOL;
        return $xhtml;
    }
}